Advanced Architecting on AWS
ECS β’ EKS β’ Fargate β’ ECR β’ Networking β’ Service Mesh
| Component | Role | Details |
|---|---|---|
| Task Definition | Blueprint | Container image, CPU/memory, ports, IAM role, volumes |
| Task | Running instance | One or more containers from a task definition |
| Service | Desired state | Maintains N tasks, integrates with ALB, auto-scales |
| Cluster | Logical grouping | EC2 instances or Fargate β infrastructure for tasks |
| Capacity Provider | Infrastructure strategy | Fargate, Fargate Spot, or ASG-backed EC2 |
| Mode | ECS | Behavior |
|---|---|---|
| awsvpc | Required for Fargate | Each task gets its own ENI + private IP. Full SG support. |
| bridge | EC2 launch type | Docker bridge network. Port mapping required. Less isolation. |
| host | EC2 launch type | Container uses host network. Best performance, no isolation. |
# Register a task definition aws ecs register-task-definition --cli-input-json file://task-def.json # Create an ECS service with ALB aws ecs create-service --cluster prod-cluster \ --service-name web-api --task-definition web-api:3 \ --desired-count 3 --launch-type FARGATE \ --network-configuration "awsvpcConfiguration={subnets=[subnet-xxx],securityGroups=[sg-xxx],assignPublicIp=DISABLED}" \ --load-balancers "targetGroupArn=arn:...,containerName=web,containerPort=8080" # Scale the service aws ecs update-service --cluster prod-cluster \ --service web-api --desired-count 5
Q1: An ECS task needs to communicate with an RDS database. The security team requires that network access be controlled at the task level. Which network mode should be used?
A) bridge B) host C) awsvpc D) none
Q2: What is the key advantage of EKS Fargate profiles over managed node groups?
A) Lower cost B) No node management β serverless per-pod compute C) GPU support D) Faster scaling
ECS
Task definitions β Tasks β Services. Capacity providers (Fargate/EC2). awsvpc for isolation.
EKS
Managed K8s control plane. Node groups or Fargate. VPC CNI for pod networking. Add-ons managed.
ECR & Networking
Private registries. Image scanning. awsvpc = ENI per task. SG-for-pods in EKS.
Service Mesh
App Mesh with Envoy sidecars. Traffic management, mTLS, observability for microservices.